<?php 
    include_once('../includes/common.inc.php');
    
    if(check_login()==true){
        header('location: index.php');
    }
    
    
    $_title ="Login";
    $error_message ='';
    
    include_once('../dal/adminDAL.php');
    
    if(isset($_POST["username"]) && isset($_POST["password"]))
    {
        $username = $_POST["username"];
        $password = $_POST["password"];
        $result = array();
        $adminDAL = new AdminDAL();
        $result = $adminDAL->login($username,$password);
        
        if($result["message"] == '')
        {
            $error_message= $result["error_message"];
        }
    }
    
    include_once('../views/admin/header.php');
    
    
    
    include_once('../views/admin/login.php');

?>